<%@ page language="java" import="java.util.*,com.cch.examSystem.entity.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Object obj=request.getAttribute("category");
Object obj1=request.getAttribute("type");
if(obj==null||obj1==null) return;
List<CategoryRelation> bufferList=new ArrayList();
String type=(String)obj1;
%>
<%
	List<CategoryRelation> list=(ArrayList)obj;
%>
<% 
	for(int i=0;i<list.size();i++){
		CategoryRelation category=list.get(i);
		if(category.getSuperId()!=0){
			bufferList.add(list.get(i));
			list.remove(i);
			i--;
		}
	}
	boolean classflag=true;
	if(bufferList.size()==0)  classflag=false;	
%>

<%
	
%>
<%	
	String IDname="show";
	if(type.equals("true")){
		
	for(CategoryRelation category:list){
		boolean flag=true;
		
%>
<li><a  href="javascript:void(0)" value="<%=category.getName() %>" class="<%="profession"%>" name="<%=category.getId()%>"><%=category.getName() %>
<%
		for(CategoryRelation bufferCategory:bufferList){
			if(bufferCategory.getSuperId()==category.getId()){
				if(flag){
%>				<i class="arrow Hui-iconfont"></i></a>
				<ul class="menu">
<%
				flag=false;
				}
%>
			<li><a  href="javascript:void(0)" class="<%=IDname%>"  name="<%=bufferCategory.getId() %>"><%=bufferCategory.getName() %></a></li>
<%
			}	
		}
	if(flag==false){
%>
	</ul>
	<%} %>
</li>
<% 
	}
	}else{
		
		for(CategoryRelation category:list){
			if(category.getSuperId()==0){
%>

<li><a  href="javascript:void(0)" class="<%=IDname%>"  name="<%=category.getId() %>"><%=category.getName() %></a></li>
<%
			}
		}
	}
%>
